package com.example.smart.dialog

import android.app.Activity
import android.view.Gravity
import android.view.View
import com.example.lib.extend.getDeviceWidth
import com.example.lib.extend.setOnDoubleClickListener
import com.example.smart.R
import com.example.smart.base.dialog.base.BaseDialog
import com.example.smart.databinding.DialogDeleteBinding

class DeleteDialog(val activity: Activity) : BaseDialog<DialogDeleteBinding>(dialogContext = activity,
    width = (getDeviceWidth(activity)),
    gravity = Gravity.BOTTOM,
    style = R.style.inputDialogStyle) {
    var onConfirm: (() -> Unit)? = null

    override fun setLayoutRes() = com.example.smart.R.layout.dialog_delete

    override fun afterViewCreate(view: View?) {
        binding.DialogConfirm.setOnDoubleClickListener {
            dismiss()
            onConfirm?.invoke()
        }
    }
}